//
//  NotiPushTool.m
//  ReceiptDelivery
//
//  Created by 吕晶 on 2021/4/27.
//  Copyright © 2021 吕晶. All rights reserved.
//

#import "NotiPushTool.h"
#import "TaskManagerMainVC.h"
#import "TaskManagerDetailVC.h"

@implementation NotiPushTool

- (void)pushVCWithMessage:(NSMutableDictionary *)dic {
    NSString *msgcode = [dic objectForKey:@"msgcode"];
    if ([msgcode isEqualToString:@"012"] || [msgcode isEqualToString:@"016"] || [msgcode isEqualToString:@"025"] || [msgcode isEqualToString:@"t_007"]) {
        //我的任务-未受理
        TaskManagerMainVC *vc = [TaskManagerMainVC new];
        vc.hidesBottomBarWhenPushed = YES;
        vc.selectIdx = 1;
        [[FactoryMethod getCurrentVC].rt_navigationController pushViewController:vc animated:YES];
    }else if ([msgcode isEqualToString:@"013"] || [msgcode isEqualToString:@"039"]) {
        //抢单
        [[FactoryMethod getCurrentVC].rt_navigationController popToRootViewControllerAnimated:NO];
        MainTabBarController *vc = [MainTabBarController instance];
        vc.idx = 1;
        [[NSNotificationCenter defaultCenter] postNotificationName:ReceiptDeliveryRefreshGrabOrderList object:nil];
    }else if ([msgcode isEqualToString:@"015"] || [msgcode isEqualToString:@"026"]) {
        //已作废
        
    }else if ([msgcode isEqualToString:@"017"]) {
        //任务单驳回
        TaskManagerMainVC *vc = [TaskManagerMainVC new];
        vc.hidesBottomBarWhenPushed = YES;
        vc.isBoHui = YES;
        [[FactoryMethod getCurrentVC].rt_navigationController pushViewController:vc animated:YES];
    }else if ([msgcode isEqualToString:@"018"]) {
        //提货出发
        TaskManagerMainVC *vc = [TaskManagerMainVC new];
        vc.hidesBottomBarWhenPushed = YES;
        vc.selectIdx = 3;
        [[FactoryMethod getCurrentVC].rt_navigationController pushViewController:vc animated:YES];
    }else if ([msgcode isEqualToString:@"019"]) {
        //装车
        TaskManagerDetailVC *vc = [TaskManagerDetailVC new];
        vc.hidesBottomBarWhenPushed = YES;
        vc.sta_id = [NSString stringWithFormat:@"%d",[[dic objectForKey:@"info_id"] intValue]];
        [[FactoryMethod getCurrentVC].rt_navigationController pushViewController:vc animated:YES];
    }else if ([msgcode isEqualToString:@"028"] || [msgcode isEqualToString:@"037"] || [msgcode isEqualToString:@"038"]) {
        //已受理
        TaskManagerMainVC *vc = [TaskManagerMainVC new];
        vc.hidesBottomBarWhenPushed = YES;
        vc.selectIdx = 2;
        [[FactoryMethod getCurrentVC].rt_navigationController pushViewController:vc animated:YES];
    }else if ([msgcode isEqualToString:@"040"]) {
        //计划-未受理
        TaskManagerMainVC *vc = [TaskManagerMainVC new];
        vc.hidesBottomBarWhenPushed = YES;
        vc.isPlan = YES;
        vc.selectIdx = 0;
        [[FactoryMethod getCurrentVC].rt_navigationController pushViewController:vc animated:YES];
    }else if ([msgcode isEqualToString:@"041"]) {
        //计划-已受理
        TaskManagerMainVC *vc = [TaskManagerMainVC new];
        vc.hidesBottomBarWhenPushed = YES;
        vc.isPlan = YES;
        vc.selectIdx = 1;
        [[FactoryMethod getCurrentVC].rt_navigationController pushViewController:vc animated:YES];
    }else if ([msgcode isEqualToString:@"033"] || [msgcode isEqualToString:@"034"]) {
        //不处理
        
    }
}

@end
